<?php $this->load->view('admin/header.php');?>
<style type="text/css">
    .w200px {
        width: 200px!important;
    }
</style>
<div class="columns clr">
	<div class="side-col">
	<ul id="general_form_tabs" class="tabs">
		<li><a id="general_form_tabs_group_ganeral" class="tab-item-link" href="javascript:void(0)">
		<span>General</span></a></li>
	</ul>
	</div>
	<div class="main-col">
	<div class="main-col-inner">
	<div class="content-header clr">
	<h3>Các thuộc tính trong Table chính</h3>
	<p class="form-buttons">
	<button id="id_1751401066463028" title="Back" class="back scalable" type="button" onclick="javascript:history.go(-1)">
		<span>Back</span>
	</button>
	<button id="id_4084262853963567" title="Reset" class="scalable" type="button" onclick="setLocation(window.location.href)"><span>Reset</span></button>
	<button id="id_4443156804521954" title="Save" class="save scalable" type="button" onclick="general_formForm.submit();"><span>Save</span></button>
	</p>
	</div>
	<div class="entry-edit">
	<?php echo form_open('admin/general/fiel_columns', array('id' => 'general_formForm'));?>
		<div>
		    <input type="hidden" value="" name="ci_csrf_token">
		    <?php echo form_hidden('main_table', $main_table);?>
		</div>
		<div id="general_form_tabs_group_ganeral_content" class="tab_content" style="">
		<div class="entry-edit-head clr"><h4>General</h4></div>
		<div id="" class="fieldset">
		<div class="hor-scroll">
		<?php echo validation_errors(); ?>
		    <table class="form-list" cellspacing="0">
                <tbody>
                <tr>
                    <td class="label"><label for="main_table">Tên module <span class="required">*</span></label>
                    </td>
                    <td class="value">
                        <?php echo form_input('module_name', substr($main_table,0,-1));?>
                    </td>
                </tr>
                </tbody>
                </table>
            <table class="grid massaction">
                <thead>
                <tr class="headings">
                    <th class="w200px">Fiel Name</th>
                    <th>Display Label</th>
                    <th>Field Type</th>
                    <th>Display Type</th>
                    <th>Requite</th>
                    <th>Show List</th>
                    <th>Sort</th>
                    <th>Search</th>
                </tr>
                </thead>
                <tbody>
                <?php foreach ($data as $value):?>
                    <tr class="pointer">
                        <td><?php echo form_hidden('field[]', $value['Field']); echo $value['Field'];?></td>
                        <td><?php echo form_input('display_name[]', $value['Field']);?></td>
                        <td><?php echo form_hidden('type[]', $value['Type']); echo $value['Type'];?></td>
                        <td><?php echo form_dropdown('display_field_type[]', $display_field_type, setValueSelect($value['Type']));?></td>
                        <td><input type="checkbox" name="requite[]" value="<?php echo $value['Field'];?>"></td>
                        <td><input type="checkbox" checked="checked" name="showlist[]" value="<?php echo $value['Field'];?>"></td>
                        <td><input type="checkbox" name="sort[]" value="<?php echo $value['Field'];?>"></td>
                        <td><input type="checkbox" name="search[]" value="<?php echo $value['Field'];?>"></td>
                    </tr>
                <?php endforeach;?>
                </tbody>
                <tfoot>
                </tfoot>
            </table>
		</div>
		</div>
		</div>
	</form>
	</div>
	</div>
	</div>
</div>
<?php $this->load->view('admin/footer.php');?>
<?php
function setValueSelect($string) {
    if (strstr($string, 'varchar') != FALSE) {
        return 'text';
    }
    if (strstr($string, 'tinyint') || strstr($string, 'smallint')) {
        return 'publish';
    }
    if (strstr($string, 'int')) {
        return 'select';
    }
    if (strstr($string, 'datetime') > 0 || strstr($string, 'date')) {
        return 'date';
    }
    if (strstr($string, 'text')) {
        return 'editor';
    }
    return '';
}
?>